.beibeibeibei-panel-warpper {
    width: 310px;
    height: 190px;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    transition-timing-function: linear(0 0%, 0 1.8%, 0.01 3.6%, 0.03 6.35%, 0.07 9.1%, 0.13 11.4%, 0.19 13.4%, 0.27 15%, 0.34 16.1%, 0.54 18.35%, 0.66 20.6%, 0.72 22.4%, 0.77 24.6%, 0.81 27.3%, 0.85 30.4%, 0.88 35.1%, 0.92 40.6%, 0.94 47.2%, 0.96 55%, 0.98 64%, 0.99 74.4%, 1 86.4%, 1 100%);
    transition-duration: .3s;
    z-index: 1061;
}

.beibeibeibei-panel-warpper svg {
    vertical-align: initial;
}

.corner-box-warpper {
    .corner-box {
        background: transparent;
        opacity: 0;
        width: 310px;
        height: 190px;
        position: fixed;
        pointer-events: none;
    }

    .topright {
        z-index: -99999;
        top: 0;
        right: 0;
    }

    .bottomright {
        z-index: -99999;
        bottom: 0;
        right: 0;
    }

    .bottomleft {
        z-index: -99999;
        bottom: 0;
        left: 0;
    }

    .topleft {
        z-index: -99999;
        top: 0;
        left: 0;
    }
}

.beibeibeibei-panel-border {
    background: black;
    width: fit-content;
    height: fit-content;
    border-radius: 6px;
}

@keyframes movebackground {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.beibeibeibei-panel-border.running {
    background: linear-gradient(45deg, rgb(84 58 181), rgb(84 58 181 / 70%), rgb(0 172 193 / 70%), rgb(87 228 246), rgb(255 255 255));
    animation: movebackground 4s infinite linear;
    background-size: 400%;
}

#beibeibeibei-panel {
    width: 300px;
    height: 180px;
    display: flex;
    flex-direction: column;
    background: black;
    padding: 2px;
    border: 1px solid white;
    border-radius: 6px;

    overflow: hidden;
    interpolate-size: allow-keywords;
    margin: 2px;
    transition-duration: 0.3s;
    transition-timing-function: linear(0 0%, 0 1.8%, 0.01 3.6%, 0.03 6.35%, 0.07 9.1%, 0.13 11.4%, 0.19 13.4%, 0.27 15%, 0.34 16.1%, 0.54 18.35%, 0.66 20.6%, 0.72 22.4%, 0.77 24.6%, 0.81 27.3%, 0.85 30.4%, 0.88 35.1%, 0.92 40.6%, 0.94 47.2%, 0.96 55%, 0.98 64%, 0.99 74.4%, 1 86.4%, 1 100%);
}

#beibeibeibei-panel .titlebar {
    display: flex;
    justify-content: flex-end;
    -webkit-user-select: none;
    user-select: none;
    container-name: titlebar;
    container-type: inline-size;
}

#beibeibeibei-panel .titlebar>* {
    width: 22px;
    height: 22px;
    padding: 0;
    overflow: hidden;
}

#beibeibeibei-panel .titlebar>*:not(:last-child) {
    margin-right: 2px;
}

@container titlebar (max-width: 120px) {

    /* 父容器宽度不够时不显示 */
    #beibeibeibei-panel .titlebar>*:not(:last-child) {
        display: none;
    }
}

#beibeibeibei-panel .titlebar>button {
    cursor: pointer;
}

#beibeibeibei-panel .titlebar>.led {
    border: 1px solid #767676;
    background-color: #efefef;
    border-radius: 3px;
    box-sizing: border-box;
    cursor: help;
    overflow: hidden;
}

@supports (rx: 0) {
    #beibeibeibei-panel .titlebar>.led ellipse {
        transform-origin: 10px 10px;
        fill: gray;
        rx: 7;
        ry: 1;
        transform: rotate(120deg);
        transition: all 0.3s ease-out;
    }
}

@supports not (rx: 0) {
    #beibeibeibei-panel .titlebar>.led ellipse {
        transform-origin: 10px 10px;
        fill: gray;
        transform: rotate(120deg) scaleX(1.4) scaleY(0.2);
        transition: all 0.3s ease-out;
    }
}

@keyframes flicker {

    0%,
    100% {
        transform: rotate(120deg) scale(1);
    }

    50% {
        transform: rotate(120deg) scale(1.2);
    }
}

@supports (rx: 0) {
    #beibeibeibei-panel .titlebar>.led.websocket-connected ellipse {
        animation: flicker 1.5s infinite;
        fill: #44ff00;
        rx: 5;
        ry: 5;
    }
}

@supports not (rx: 0) {
    #beibeibeibei-panel .titlebar>.led.websocket-connected ellipse {
        animation: flicker 1.5s infinite;
        fill: #44ff00;
    }
}

#beibeibeibei-panel .titlebar>.min .vline {
    opacity: 0;
}

#beibeibeibei-panel .msgs {
    flex-grow: 1;
    margin: 4px 0px;
    background: #2d2d2d;
    overflow-y: auto;
}

#beibeibeibei-panel .msgs .info,
#beibeibeibei-panel .msgs .msg,
#beibeibeibei-panel .msgs .error {
    color: #efefef;
    font-size: 9px;
    margin: 0;
}

#beibeibeibei-panel .msgs .error {
    color: #87ceeb;
}

#beibeibeibei-panel .footer {
    display: flex;
    height: 30px;
    min-height: 30px;
    justify-content: space-between;
}

#beibeibeibei-panel .footer>* {
    width: calc(50% - 2px);
    box-sizing: border-box;
    text-align: center;
    font-family: Arial, sans-serif;
}

#beibeibeibei-panel .footer>input {
    background: white;
    border: 2px solid gray;
    border-radius: 4px;
}

#beibeibeibei-panel .footer>.start {
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    white-space: nowrap;
}

/*隐藏输入框箭头*/
.beibeibeibei-panel-warpper input::-webkit-outer-spin-button,
.beibeibeibei-panel-warpper input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0;
}

@supports (-moz-appearance:none) {
    @-moz-document url-prefix() {
        .beibeibeibei-panel-warpper input[type="number"] {
            -moz-appearance: textfield;
            appearance: none;
        }
    }
}

#beibeibeibei-panel-rule-dialog {
    position: fixed;
    top: 50%;
    transform: translateY(round(-50%, 1px));
    border: none;
    border-radius: 6px;
    margin: 0 auto;
    padding: 0;
    box-shadow: 1px 1px 5px 2px white;

    &::backdrop {
        /* Safari 9+ */
        -webkit-backdrop-filter: blur(1px);
        backdrop-filter: blur(1px);
    }

    .title {
        width: 100%;
        height: 31px;
        background-color: black;
        display: flex;
        flex-direction: row-reverse;
        border-radius: 6px 6px 0 0;
        border-bottom: 1px solid #555;

        .close {
            width: 46px;
            height: 100%;
            background-color: black;
            color: white;
            border-radius: 0 6px 0 0;
            border: none;
            cursor: pointer;
            outline: none;

            &:focus {
                border: 1px solid white;
            }

            svg {
                transition: all 0.1s;

                line {
                    transition: all 0.1s;
                    transform-origin: center;
                }
            }

            &:hover {
                background-color: #0F0000;

                svg {
                    transform: rotate(90deg);
                }
            }

            &:active {
                border: 1px solid darkred;

                svg {
                    line {
                        transform: rotate(90deg);
                        stroke: red;
                    }
                }
            }
        }
    }

    .table {
        min-width: 180px;
        min-height: 100px;
        background-color: #222;
        color: white;
        border-radius: 0 0 6px 6px;
        padding: 10px;
        font-size: 12px;

        .column {
            display: flex;
            height: 40px;
            background-color: black;

            >* {
                width: 100px;
                overflow: hidden;
                display: flex;
                justify-content: center;
                align-items: center;
            }

            >*:not(:last-child) {
                border-right: 1px solid gray;
            }
        }

        .column.header {
            border-radius: 6px 6px 0 0;
            border: 1px solid gray;

            >*:last-of-type {
                /*不选中规则删除这个格子*/
                -webkit-user-select: none;
                user-select: none;
            }
        }

        .column.body {
            border: 1px solid gray;
            border-top: none;

            button.remove {
                background-color: #111;
                color: white;
                border: 1px solid white;
                border-radius: 4px;
                cursor: pointer;
                -webkit-user-select: none;
                user-select: none;

                &:hover {
                    border-color: #BBB;
                    box-shadow: inset 0px 0px 2px 0px white;
                }

                &:active {
                    border-color: #888;
                    color: #888;
                    transform: scale(0.95);
                }
            }
        }

        .column:last-of-type {
            border-radius: 0 0 6px 6px;
        }


        .add {
            width: 100%;
            height: 40px;
            cursor: pointer;
            background-color: black;
            color: white;
            border: 1px solid white;
            border-radius: 6px;
            margin-top: 4px;
            -webkit-user-select: none;
            user-select: none;

            &:hover {
                box-shadow: inset 0px 0px 2px 0px white;
            }

            &:active {
                transform: translate(1px, 1px);
                width: calc(100% - 2px);
            }
        }
    }
}

#beibeibeibei-panel-add-rule-dialog {
    position: fixed;
    top: 50%;
    transform: translateY(round(-50%, 1px));
    border: none;
    border-radius: 6px;
    margin: 0 auto;
    padding: 0;
    box-shadow: 0px 0px 5px 0px white;
    background-color: black;
    width: 470px;
    overflow: hidden;

    &::backdrop {
        /* Safari 9+ */
        -webkit-backdrop-filter: blur(1px);
        backdrop-filter: blur(1px);
    }

    .title {
        width: 100%;
        height: 31px;
        background-color: black;
        display: flex;
        flex-direction: row-reverse;
        border-bottom: 1px solid #555;

        .close {
            width: 46px;
            height: 100%;
            background-color: black;
            color: white;
            border-radius: 0 6px 0 0;
            border: none;
            cursor: pointer;
            outline: none;

            &:focus {
                border: 1px solid white;
            }

            svg {
                transition: all 0.1s;

                line {
                    transition: all 0.1s;
                    transform-origin: center;
                }
            }

            &:hover {
                background-color: #0F0000;

                svg {
                    transform: rotate(90deg);
                }
            }

            &:active {
                border: 1px solid darkred;

                svg {
                    line {
                        transform: rotate(90deg);
                        stroke: red;
                    }
                }
            }
        }
    }

    .add-panel {
        background-color: #222;
        color: white;
        padding: 10px;
        font-size: 12px;

        .add-panel-item {
            margin-bottom: 10px;

            input {
                background-color: #2d3436;
                color: #ecf0f1;
                border: 1px solid #34495e;
                border-radius: 4px;
                font-size: 12px;
                padding: 1px 3px;
                outline: none;
                text-align: center;
                vertical-align: top;

                &:focus {
                    border: 1px solid white;
                }
            }

            input[type="number"] {
                width: 30px;
            }
        }

        .add-panel-item.text-center {
            text-align: center;
        }
    }

    .footer {
        display: flex;
        justify-content: space-around;
        padding: 10px;
        border-top: 1px solid #555;
        background: black;
        -webkit-user-select: none;
        user-select: none;

        button {
            background-color: #2d3436;
            color: #ecf0f1;
            border: 1px solid #34495e;
            border-radius: 4px;
            font-size: 12px;
            padding: 6px 12px;
            cursor: pointer;
            outline: none;
            transition: background-color 0.2s, transform 0.1s;

            &:hover {
                box-shadow: inset 0px 0px 5px 1px #3d4a51;
            }

            &:active {
                transform: translate(1px, 1px);
                background-color: #1a2023;
            }

            &:focus {
                border: 1px solid white;
            }
        }

        .add {
            background-color: #05150b;
        }

        .cancel {
            background-color: #170503;
        }
    }
}

/* 自定义select */
@keyframes custom-select-expand {
    0% {
        display: none;
        height: 0px;
        overflow-y: auto;
    }

    1% {
        display: block;
        overflow-y: hidden;
    }

    99% {
        display: block;
        overflow-y: hidden;
    }

    100% {
        display: block;
        height: auto;
        overflow-y: auto;
    }
}

.custom-select {
    position: relative;
    display: inline-block;

    .select-button {
        vertical-align: top;
        background-color: #2d3436;
        color: #ecf0f1;
        border: 1px solid #34495e;
        border-radius: 4px;
        padding: 0px 3px;
        padding-right: 20px;
        font-size: 12px;
        text-align: center;
        background-repeat: no-repeat;
        background-position: right 2px top 2px;
        outline: none;
        cursor: pointer;
    }

    .select-button:focus {
        border: 1px solid white;
    }

    .options-container {
        position: absolute;
        left: 0;
        width: 100%;
        font-size: 12px;
        background-color: #2d3436;
        border: none;
        border-radius: 4px;
        overflow-y: auto;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        z-index: 10;
        white-space: nowrap;
        height: 0px;
        interpolate-size: allow-keywords;
    }


    .options-container::-webkit-scrollbar {
        width: 6px;
        background: #202324;
        border-radius: 0 3px 3px 0;
    }

    .options-container::-webkit-scrollbar-thumb {
        background: #454a4d;
        border-radius: 3px;
    }

    .options-container::-webkit-scrollbar-thumb:hover {
        background: #575e62;
    }

    .option-item {
        background-color: #2d3436;
        color: #ecf0f1;
        padding: 4px 0px;
        text-align: center;
        cursor: pointer;
    }

    .option-item:hover {
        background: #777;
    }

    .option-item:focus {
        background: #777;
    }

    .option-item:focus-visible {
        outline: none;
        background: #777;
    }
}

/* 选项向上展开 */
.custom-select.position-above {
    .select-button {
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0 0 11 11'%3e%3cpolygon%20points='3,6 5,4 7,6'%20style='fill:white;stroke:white;stroke-width:1'/%3e%3c/svg%3e");
    }

    .options-container {
        bottom: calc(100% + 1px);
    }

}

/* 选项向下展开 */
.custom-select.position-below {
    .select-button {
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0 0 11 11'%3e%3cpolygon%20points='3,4 5,6 7,4'%20style='fill:white;stroke:white;stroke-width:1'/%3e%3c/svg%3e");
    }

    .options-container {
        top: calc(100% + 1px);
    }
}

/* 选项右侧展开 */
.custom-select.position-right {
    .select-button {
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0 0 11 11'%3e%3cpolygon%20points='4,6 6,4 4,2' style='fill:white;stroke:white;stroke-width:1'/%3e%3c/svg%3e");
    }

    .options-container {
        top: calc(50%);
        left: calc(100% + 1px);
        transform: translateY(-50%);
    }
}